package Test2;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MyTest {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException {

        Class clazz = Class.forName("Test2.Test");

        Test o = (Test) clazz.newInstance();

        Method[] declaredMethods = clazz.getDeclaredMethods();

        for (Method declaredMethod : declaredMethods) {
            Class<UseTest> annotationClass = UseTest.class;
            if(declaredMethod.isAnnotationPresent(annotationClass)){
                 declaredMethod.invoke(o);
            }
        }
    }
}
